package com.world.rickcloudendpoint.demo.redis;

import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;

/**
 * @description:
 * @author: jlsong
 * @date: 2022/05/31 10:08:50
 * @version: 1.0
 */
@Component
public class RedisQueueReceiver {

    final RedisTemplate<String, Object> redisTemplate;


    public RedisQueueReceiver(RedisTemplate<String, Object> redisTemplate) {
        this.redisTemplate = redisTemplate;
    }

    public void receiverMsg(String queueName) {
        // 阻塞获取消息
        Object msg = redisTemplate.boundListOps(queueName).rightPop();
    }
}
